package com.trust.entity.VO;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.trust.agri.sign.validate.SaveValidate;
import com.trust.agri.sign.validate.UpdateValidate;
import com.trust.entity.PurchaseDetail;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;
import java.util.Date;
import java.util.List;

/**
 * @author ccc
 * @desc
 * @since 2023/11/24 17:13
 */
@Data
@ApiModel("采购单vo")
public class PurchaseVO {

    @ApiModelProperty("id")
    @Null(message = "id 只能为空", groups = {SaveValidate.class})
    @NotNull(message = "id 不能为空", groups = {UpdateValidate.class})
    private Integer id;

    @ApiModelProperty("负责人")
    @NotNull(message = "负责人 不能为空", groups = {SaveValidate.class, UpdateValidate.class})
    private Integer principal;

    @ApiModelProperty(value = "负责人名称", allowEmptyValue = true)
    private String principalName;

    @ApiModelProperty(value = "采购时间", allowEmptyValue = true)
    private Date purchaseTime;

    @ApiModelProperty(value = "采购时间")
    @NotNull(message = "采购时间 不能为空", groups = {SaveValidate.class, UpdateValidate.class})
    @JsonFormat(pattern = "yyyy年MM月dd日", timezone = "GMT+8")
    private Date purchaseTimeStr;

    @ApiModelProperty("记录人")
    @NotNull(message = "记录人 不能为空", groups = {SaveValidate.class, UpdateValidate.class})
    private Integer recorder;

    @ApiModelProperty("记录人名称")
    private String recorderName;

    @ApiModelProperty("采购描述")
    @NotBlank(message = "采购描述 不能为空", groups = {SaveValidate.class, UpdateValidate.class})
    private String description;

    @ApiModelProperty(value = "状态 0待入库 1已入库", allowEmptyValue = true)
    private Integer state;

    @ApiModelProperty("采购单号")
    @NotBlank(message = "采购单号 不能为空", groups = {SaveValidate.class, UpdateValidate.class})
    private String code;

    @ApiModelProperty("采购明细")
    @NotEmpty(message = "采购明细 不能为空", groups = {SaveValidate.class, UpdateValidate.class})
    private List<PurchaseDetail> details;
}
